3Commas DCA Bot Strategy v1.0Introduction
The strategy attempts to implement a majority all of the settings found on the 3Commas DCA Bot setting page that can be implemented within a TradingView indicator. Specifically, it will implement the "Open new trade ASAP" and "Trading View Custom Signal" deal start conditions. In this way, you can leverage the power of TradingView's backtester to model your settings and analysis past performance as well as leverage TradingView's alert notification subsystem to send Deal Start and Close signals to 3Commas using almost any of the thousands of scripts found in the Public Library (see "What does it do and how does it do it?" section below for more information on how to do this using the RSI indicator as an example).
How is it original and useful?
This strategy is unique in that it's the only one (as of the initial publications) that can handle 28 out of 32 bot settings (88% coverage) that are found on the 3Commas bot settings page. In addition, because it is a TradingView script, you will benefit from the following:
Model your bot's configuration using the backtester on any timeframe and evaluate its performance using the chart's history.
View a table of detailed statistics pertaining to deals started and completed, win/loss rates, daily P&L, true max drawdown, and detailed statistics on bars in deal along with safety orders filled.
View a table of "Used amount for each step" as presented in 3Commas as well.
Ability to link to almost any TradingView chart indicator that provides a single data point for buy/sell signals.
Make use of the 3Commas TA Start Conditions indicator to emulate the 3Commas built-in indicators for further performance evaluation with the backtester.
How does it compare to other scripts in the Public Library?
This strategy offers a very detailed, comprehensive settings and maybe the only one (as of the initial publication) that can handle 28 out of the 32 bot settings that are found on the 3Commas bot settings page (that can be handled within TradingView, because some cannot be modeled due to chart and language constraints). Specifically, the following 3Commas bot settings and inputs are addressed with asterisks denoting specific limitation due to TradingView's platform architecture and/or constraints:
Main settings
✅ Name
❌ Exchange* (Not handled since it is inherited from chart)
⚠ Bot type* (Only Single-pair because you simply apply the indicator to as many pairs you desire in separate charts to simulate a Multi-pair setting)
Pairs
❌ Pairs* (Not handled since it is inheriting the symbol from the chart)
Strategy
✅ Strategy
❌ Profit currency* (Not handled since there is no equivalence in TradingView)
✅ Base order size / unit
✅ Safety order size / unit
✅ Start order type
Deal start condition
⚠ TradingView* (You can modify the "Technical Rating" indicator by TradingView to output a signal yourself like @TheTradingParrot has done in the TV signal for DCA backtest script)
⚠ QFL* (See Quickfingers Luc's Base Breaking Strategy v2.5 - 3Commas Edition for an alternative)
❌ Manually/API* (Not handled since there is no equivalence in TradingView)
✅ Trading View custom signal
✅ Open new trade asap
Take profit
✅ Take profit (%)
✅ Take profit type
✅ Trailing
⚠ Trailing deviation* (modified to handle TradingView's broker emulator properly)
Stop loss
✅ Stop Loss (%)
✅ Stop Loss action
⚠ Stop Loss timeout* (modified to use "bars" as the unit of measure)
Safety orders
✅ Max safety trades count (a total of 100 safety orders are supported!)
⚠ Max active safety trades count* (Not handled since there is no equivalence in TradingView)
✅ Price deviation to open safety orders (% from initial order)
✅ Safety order volume scale
✅ Safety order step scale
Advanced settings
✅ Don't start deal(s) if the daily volume is less than
✅ Minimum price to open deal
✅ Maximum price to open deal
⚠ Deal start delay (QFL and standard TV signals only)* (modified to use "bars" as the unit of measure)
✅ Cooldown between deals
✅ Open deals & stop
Close deal after timeout
⚠ The time after which, deal will be closed automatically* (modified to use "bars" as the unit of measure)
In addition to the above inputs, the script will also support the same output data points that are found on the bot settings page, which are:
Assistant
✅ Balance
✅ Max amount for bot usage (Based on current rate)
✅ Max safety order price deviation
✅ % of available balance to be used by the bot
Table (Used amount for each step)
✅ Order No.
✅ Deviation %
✅ Order Size (Base currency)
✅ Order Volume (Quote currency)
✅ Price
✅ Average price
✅ Required price
✅ Required change
✅ Total Size (Base currency)
✅ Total Volume (Quote currency)
What does it do and how does it do it?
When applied to the chart for the first time, the default settings will work to execute the "Open new trade asap" deal start condition using a take profit of 4%, a base order size of 1.335% of equity (initial capital + net profit), a safety order size of 2.003% of equity (initial capital + net profit), a safety order volume scale of 1.5, a safety order step scale of 1.21, and a max safety trades count of 8. With these settings, as you scroll through the chart's history you should see price action crossing the DCA layers (denoted with blue triangles), and a green take-profit price line will render (with green triangle denoting the crossings). Lastly, in the upper-right corner of the chart the table of DCA statistics will render showing you all the gathered data that took place since the chart's starting history until the current time.
Using the "TV Custom Signal" section will allow you to "link" other chart indicators to supply "Start" and "Close" signals for the script. For example, here's how you can use the standard RSI indicator to generate an entry signal:
1) Add the stock RSI indicator and configure it to your desire.
2) Select the "RSI" indicator in the "Chart/Indicator Data Point" input.
3) Select "Chart/Indicator Data Point" in the "Start Deal When" input.
4) Select "Less Than" in the "Is" input.
5) Select "Custom Value(s)" in the "The Value Of" input.
6) Enter "25" in the "Custom Value 1 (Single or Lower Bound)" input.
7) Select "Trading View Custom Signal" in the "Open new trade" input (in the DEAL START CONDITION section).
8) Lastly, check the checkbox with a horizontal straight line above the "Start Deal When" input.
This means that the indicator will start a deal when the "RSI indicator" is "Less Than" the value of "25".
Strategy Results
The default settings are designed to ensure that the indicator will render chart elements when first loaded as well as to allow the backtester to gather order executions and display performance summary. The chart above is is using $10,000 initial capital, a commission rate of 0.1% for both entries and exits, and a 1 tick slippage setting. It is also using 3.22581% of the equity for the Base Order Size, 6.45161% of equity for the first Safety Order Size. The Maximum Safety Trade Count is 4 with a Safety Order Volume Scale of 2, a Safety Order Step Scale of 1.53, Price Deviation To Option Safety Orders at 5.3, and a take profit of 4.5% with Trailing turned on at a deviation of 1.5%. All other settings are defaults.
It is recommended that the indicator be "tuned" for your specific market in order to best implement the strategy and obtain better desirable results. You do so by using the backtester and statistics table and observe the output values and learn how the indicator is performing in the chart history. Using this information, you can adjust the settings accordingly until you find the settings acceptable to your trading goals and risk tolerance.
Always keep in mind that past performance may not be indicative of future results. Settings that seem favorable for one market may be found to be disastrous in another. Therefore, do take the time needed to understand how the settings will behave with the given chart symbol.
Enjoy! 😊👍
How to obtain access to the script?
You have two choices:
Use the "Website" link below to obtain access to this indicator, or
Send us a private message (PM) in TradingView itself.
Cari dalam skrip untuk "the script"
Matrix Library (Linear Algebra, incl Multiple Linear Regression)What's this all about?
Ever since 1D arrays were added to Pine Script, many wonderful new opportunities have opened up. There has been a few implementations of matrices and matrix math (most notably by TradingView-user tbiktag in his recent Moving Regression script: ). However, so far, no comprehensive libraries for matrix math and linear algebra has been developed. This script aims to change that.
I'm not math expert, but I like learning new things, so I took it upon myself to relearn linear algebra these past few months, and create a matrix math library for Pine Script. The goal with the library was to make a comprehensive collection of functions that can be used to perform as many of the standard operations on matrices as possible, and to implement functions to solve systems of linear equations. The library implements matrices using arrays, and many standard functions to manipulate these matrices have been added as well.
The main purpose of the library is to give users the ability to solve systems of linear equations (useful for Multiple Linear Regression with K number of independent variables for example), but it can also be used to simulate 2D arrays for any purpose.
So how do I use this thing?
Personally, what I do with my private Pine Script libraries is I keep them stored as text-files in a Libraries folder, and I copy and paste them into my code when I need them. This library is quite large, so I have made sure to use brackets in comments to easily hide any part of the code. This helps with big libraries like this one.
The parts of this script that you need to copy are labeled "MathLib", "ArrayLib", and "MatrixLib". The matrix library is dependent on the functions from these other two libraries, but they are stripped down to only include the functions used by the MatrixLib library.
When you have the code in your script (pasted somewhere below the "study()" call), you can create a matrix by calling one of the constructor functions. All functions in this library start with "matrix_", and all constructors start with either "create" or "copy". I suggest you read through the code though. The functions have very descriptive names, and a short description of what each function does is included in a header comment directly above it. The functions generally come in the following order:
Constructors: These are used to create matrices (empy with no rows or columns, set shape filled with 0s, from a time series or an array, and so on).
Getters and setters: These are used to get data from a matrix (like the value of an element or a full row or column).
Matrix manipulations: These functions manipulate the matrix in some way (for example, functions to append columns or rows to a matrix).
Matrix operations: These are the matrix operations. They include things like basic math operations for two indices, to transposing a matrix.
Decompositions and solvers: Next up are functions to solve systems of linear equations. These include LU and QR decomposition and solvers, and functions for calculating the pseudo-inverse or inverse of a matrix.
Multiple Linear Regression: Lastly, we find an implementation of a multiple linear regression, including all the standard statistics one can expect to find in most statistical software packages.
Are there any working examples of how to use the library?
Yes, at the very end of the script, there is an example that plots the predictions from a multiple linear regression with two independent (explanatory) X variables, regressing the chart data (the Y variable) on these X variables. You can look at this code to see a real-world example of how to use the code in this library.
Are there any limitations?
There are no hard limiations, but the matrices uses arrays, so the number of elements can never exceed the number of elements supported by Pine Script (minus 2, since two elements are used internally by the library to store row and column count). Some of the operations do use a lot of resources though, and as a result, some things can not be done without timing out. This can vary from time to time as well, as this is primarily dependent on the available resources from the Pine Script servers. For instance, the multiple linear regression cannot be used with a lookback window above 10 or 12 most of the time, if the statistics are reported. If no statistics are reported (and therefore not calculated), the lookback window can usually be extended to around 60-80 bars before the servers time out the execution.
Hopefully the dev-team at TradingView sees this script and find ways to implement this functionality diretly into Pine Script, as that would speed up many of the operations and make things like MLR (multiple linear regression) possible on a bigger lookback window.
Some parting words
This library has taken a few months to write, and I have taken all the steps I can think of to test it for bugs. Some may have slipped through anyway, so please let me know if you find any, and I'll try my best to fix them when I have time to do so. This library is intended to help the community. Therefore, I am releasing the library as open source, in the hopes that people may improving on it, or using it in their own work. If you do make something cool with this, or if you find ways to improve the code, please let me know in the comments.
TradeChartist Tracker™𝗧𝗿𝗮𝗱𝗲𝗖𝗵𝗮𝗿𝘁𝗶𝘀𝘁 𝗧𝗿𝗮𝗰𝗸𝗲𝗿 is an essential real-time multi Indicator tracking toolkit that can be plotted as a standalone Indicator plot, a multi symbol tracker/screener for upto 10 different symbols and a visual scorecard for upto 5 different symbols. The indicators included in the tracker are Stochastic Oscillator, RSI, CCI, 15 different Moving Averages, MACD, Bollinger Bands %B (including Bollinger Bands and Breakout Signals), Ichimoku Cloud (including Breakout signals), Donchian Channels Oscillator (including Donchian Channels and Breakout Signals), Net Volume and Heikin Ashi Trend.
===================================================================================================================
™𝗧𝗿𝗮𝗱𝗲𝗖𝗵𝗮𝗿𝘁𝗶𝘀𝘁 𝗧𝗿𝗮𝗰𝗸𝗲𝗿 𝗨𝘀𝗲𝗿 𝗠𝗮𝗻𝘂𝗮𝗹
=====================================
™TradeChartist Tracker Plot Types
==============================
1. Indicator plot of Chart Symbol on its own , chosen from the 𝗜𝗻𝗱𝗶𝗰𝗮𝘁𝗼𝗿 𝗧𝘆𝗽𝗲 dropdown, enabling 𝐃𝐢𝐬𝐩𝐥𝐚𝐲 𝐈𝐧𝐝𝐢𝐜𝐚𝐭𝐨𝐫 𝐏𝐥𝐨𝐭 (𝐝𝐢𝐬𝐚𝐛𝐥𝐞𝐬 𝐓𝐫𝐚𝐜𝐤𝐞𝐫/𝐒𝐜𝐨𝐫𝐞𝐜𝐚𝐫𝐝).
In this example Daily chart of XRP-USDT, 55 period Stochastic is tracked for the chart symbol XRP-USDT.
2. Indicator plot of a Symbol different from the Chart Symbol , chosen from the 𝗜𝗻𝗱𝗶𝗰𝗮𝘁𝗼𝗿 𝗧𝘆𝗽𝗲 dropdown by enabling Tʀᴀᴄᴋ ᴀɴᴏᴛʜᴇʀ Sʏᴍʙᴏʟ's Iɴᴅɪᴄᴀᴛᴏʀ and entering the symbol name in the Sʏᴍʙᴏʟ ᴛᴏ Tʀᴀᴄᴋ input box, whilst keeping 𝐃𝐢𝐬𝐩𝐥𝐚𝐲 𝐈𝐧𝐝𝐢𝐜𝐚𝐭𝐨𝐫 𝐏𝐥𝐨𝐭 (𝐝𝐢𝐬𝐚𝐛𝐥𝐞𝐬 𝐓𝐫𝐚𝐜𝐤𝐞𝐫/𝐒𝐜𝐨𝐫𝐞𝐜𝐚𝐫𝐝) enabled.
In this example Daily chart of XRP-USDT, 55 period Stochastic is tracked for the BTC-USD (different from chart symbol XRP-USDT).
3. Tracker Plot of up to 10 Multiple Symbol Trackers for the Indicator chosen from the 𝗜𝗻𝗱𝗶𝗰𝗮𝘁𝗼𝗿 𝗧𝘆𝗽𝗲 dropdown, by disabling 𝐃𝐢𝐬𝐩𝐥𝐚𝐲 𝐈𝐧𝐝𝐢𝐜𝐚𝐭𝐨𝐫 𝐏𝐥𝐨𝐭 (𝐝𝐢𝐬𝐚𝐛𝐥𝐞𝐬 𝐓𝐫𝐚𝐜𝐤𝐞𝐫/𝐒𝐜𝐨𝐫𝐞𝐜𝐚𝐫𝐝) and by entering the number of trackers required in the 𝐍𝐮𝐦𝐛𝐞𝐫 𝐨𝐟 𝐓𝐫𝐚𝐜𝐤𝐞𝐫𝐬 input box under 𝗧𝗿𝗮𝗰𝗸𝗲𝗿 𝗣𝗹𝗼𝘁𝘀 section. Upto 10 Symbols can be tracked and can be input by the user in the input boxes from Sʏᴍʙᴏʟ 1,...Sʏᴍʙᴏʟ 10 . 𝐃𝐢𝐬𝐩𝐥𝐚𝐲 𝐈𝐧𝐝𝐢𝐜𝐚𝐭𝐨𝐫 𝐏𝐥𝐨𝐭 (𝐝𝐢𝐬𝐚𝐛𝐥𝐞𝐬 𝐓𝐫𝐚𝐜𝐤𝐞𝐫/𝐒𝐜𝐨𝐫𝐞𝐜𝐚𝐫𝐝) must be disabled for this plot type.
In this example Daily chart of Crypto Total Market Cap, Bollinger Bands %B is tracked for the chart symbol + 10 other Crypto symbols using Multi Symbol Trackers
4. Visual Scorecards of up to 5 Symbols for 8 indicators (all except Net Volume and HA Trend) can be plotted with real-time data by enabling 𝗗𝗶𝘀𝗽𝗹𝗮𝘆 𝗩𝗶𝘀𝘂𝗮𝗹 𝗦𝗰𝗼𝗿𝗲𝗰𝗮𝗿𝗱 - (𝟓 𝐓𝐫𝐚𝐜𝐤𝐞𝐫𝐬 𝐋𝐢𝐦𝐢𝐭). 𝐃𝐢𝐬𝐩𝐥𝐚𝐲 𝐈𝐧𝐝𝐢𝐜𝐚𝐭𝐨𝐫 𝐏𝐥𝐨𝐭 (𝐝𝐢𝐬𝐚𝐛𝐥𝐞𝐬 𝐓𝐫𝐚𝐜𝐤𝐞𝐫/𝐒𝐜𝐨𝐫𝐞𝐜𝐚𝐫𝐝) must be disabled for this plot type.
For the same example Daily chart of Crypto Total Market Cap as above, Visual Scorecard is plotted for 5 Symbols as shown.
5. Indicator Tracker labels can be plotted on Price chart by overlaying the Tracker on main chart and by switching from Separate Tracker Pane - Default to Tracker Labels only on Price Scale in the Lᴀʙᴇʟs Dɪsᴘʟᴀʏ Tʏᴘᴇ dropdown box.
In this example chart of 1hr XLM-USDT, Tracker labels of 55 EMA are plotted for 10 different symbols along with the 55 EMA plot of XLM-USDT.
Indicator plot that doesn't fit on price scale can be visualised using a second Tracker added to chart as shown in the ETH-USDT example below tracking Net Volume.
===================================================================================================================
𝗜𝗻𝗱𝗶𝗰𝗮𝘁𝗼𝗿𝘀 𝗜𝗻𝗰𝗹𝘂𝗱𝗲𝗱 𝗶𝗻 ™𝗧𝗿𝗮𝗱𝗲𝗖𝗵𝗮𝗿𝘁𝗶𝘀𝘁 𝗧𝗿𝗮𝗰𝗸𝗲𝗿
==============================================
1. Stochastic Oscillator
2. RSI
3. CCI
4. MA - (15 types included)
5. MACD
6. Bollinger Bands %B + Optional plots of Bollinger Bands and Breakout Signals
7. Ichimoku Cloud Oscillator + Optional plots of Ichimoku Cloud and Breakout Signals
8. Donchian Channels + Optional plots of Donchian Channels and Breakout Signals
9. Net Volume
10. Heikin Ashi Trend
All of the above indicators can be plotted as independent plots of the Chart Symbol or of a different symbol by enabling 𝐃𝐢𝐬𝐩𝐥𝐚𝐲 𝐈𝐧𝐝𝐢𝐜𝐚𝐭𝐨𝐫 𝐏𝐥𝐨𝐭 (𝐝𝐢𝐬𝐚𝐛𝐥𝐞𝐬 𝐓𝐫𝐚𝐜𝐤𝐞𝐫/𝐒𝐜𝐨𝐫𝐞𝐜𝐚𝐫𝐝). Some Oscillators have the option of Pʟᴏᴛ Sᴛʏʟᴇ under their relevant sections, and can be plotted as line, area or a histogram.
Oscillators 1-8 (except 4) require source price, lookback length and smoothing (where available) for the indicator plot. The colour of the tracker blocks is based on the Upper/Lower bands (where available), specified by the user in the respective sections. For example, if the RSI indicator is chosen to be plotted with Upper band at 60 and Lower band at 40, the tracker blocks and the Indicator plot paint the values between 40 and 60 in neutral colour which can be changed from the settings.
Multi Window BTC-USDT 1hr example chart below with various indicators from ™TradeChartist Tracker.
Note: The tracker colour is exactly colour of the Indicator Plot. The Visual Scorecard , however uses the mid values and doesn't take into account the bands specified by the user. For example, RSI score is green on the Visual Scorecard as long as RSI is above 50 and doesn't get affected by the user specified upper/lower band and this applies to all Oscillators. This is shown in the 1hr BTC-USDT chart below.
Moving Averages (MA) and MACD
------------------------------------------------------
Tracker plots and tracks one of 15 Moving Averages that can be chosen from the MA ᴛʏᴘᴇ and by specifying the MA Lᴇɴɢᴛʜ .
MACD uses EMA as default for calculating the MACD plots and Tracker data using Fᴀsᴛ Lᴇɴɢᴛʜ , Sʟᴏᴡ Lᴇɴɢᴛʜ and Sᴍᴏᴏᴛʜɪɴɢ . To experiment or use a different Moving Average to calculate MACD, disable 𝐔𝐬𝐞 𝐄𝐌𝐀 (Uɴᴄʜᴇᴄᴋ ᴛᴏ ᴜsᴇ MA ғʀᴏᴍ ᴀʙᴏᴠᴇ) and select the required Moving Average from MA ᴛʏᴘᴇ drop down of the 𝟰. 𝗠𝗼𝘃𝗶𝗻𝗴 𝗔𝘃𝗲𝗿𝗮𝗴𝗲 section.
Bollinger Bands %B + Optional plots of Bollinger Bands and Breakout Signals
---------------------------------------------------------------------------------------------------------------------------
Bollinger Bands %B is a companion oscillator for Bollinger Bands and helps depict where the price is, in relation to the Bollinger Bands. To plot the actual Bollinger Bands, enable Dɪsᴘʟᴀʏ Bᴏʟʟɪɴɢᴇʀ Bᴀɴᴅs and to plot the Bollinger Bands Breakout Signals, enable Sʜᴏᴡ BB Bʀᴇᴀᴋᴏᴜᴛ Sɪɢɴᴀʟs , with 𝐃𝐢𝐬𝐩𝐥𝐚𝐲 𝐈𝐧𝐝𝐢𝐜𝐚𝐭𝐨𝐫 𝐏𝐥𝐨𝐭 (𝐝𝐢𝐬𝐚𝐛𝐥𝐞𝐬 𝐓𝐫𝐚𝐜𝐤𝐞𝐫/𝐒𝐜𝐨𝐫𝐞𝐜𝐚𝐫𝐝) enabled.
Ichimoku Cloud Oscillator + Optional plots of Ichimoku Cloud and Breakout Signals
------------------------------------------------------------------------------------------------------------------------------------
Ichimoku Cloud Oscillator helps visualize the current price in relation to the breakout support/resistance of the Ichimoku Cloud using strict Ichimoku Cloud criteria (including Chikou Span agreeing with the breakout etc.). To plot the actual Ichimoku Cloud, enable Dɪsᴘʟᴀʏ Iᴄʜɪᴍᴏᴋᴜ Cʟᴏᴜᴅ and to plot the Kumo Breakout Signals, enable Sʜᴏᴡ Kᴜᴍᴏ Bʀᴇᴀᴋᴏᴜᴛ Sɪɢɴᴀʟs , with 𝐃𝐢𝐬𝐩𝐥𝐚𝐲 𝐈𝐧𝐝𝐢𝐜𝐚𝐭𝐨𝐫 𝐏𝐥𝐨𝐭 (𝐝𝐢𝐬𝐚𝐛𝐥𝐞𝐬 𝐓𝐫𝐚𝐜𝐤𝐞𝐫/𝐒𝐜𝐨𝐫𝐞𝐜𝐚𝐫𝐝) enabled.
Cloud Settings form the fundamental factor for this indicator to detect the breakouts. The settings for the Ichimoku Cloud is Automatic (detects right settings for the symbol type) by default, but this can be changed to Classic or 24/7 Crypto , based on the user preference from the settings under 𝐂𝐥𝐨𝐮𝐝 𝐓𝐲𝐩𝐞, which also includes a manual input option. Ichimoku traders can experiment different settings combinations under manual settings to suit their trading frequency and timeframe traded.
Donchian Channels + Optional plots of Donchian Channels and Breakout Signals
-------------------------------------------------------------------------------------------------------------------------------
Donchian Channels comprises of three plots - a upper band, a lower band and a mean line (or mid line of the channel). The upper band is based on highest high of N periods specified by the user and the lower band is based on the lowest low of N periods specified by the user. These channels help spot price breaching high or low of last N periods clearly, thereby aiding the trader to understand the price action of any symbol better on any given timeframe.
Donchian Channels Oscillator helps visualize the current price in relation to the Mean line of the Donchian Channels of user specified lookback period (specified in the Dᴏɴᴄʜɪᴀɴ Cʜᴀɴɴᴇʟ Lᴇɴɢᴛʜ input box). The sensitivity of the oscillator can be adjusted using smoothing factor in the Sᴍᴏᴏᴛʜɪɴɢ input box. To plot the actual Donchian Channels, enable Dɪsᴘʟᴀʏ Dᴏɴᴄʜɪᴀɴ Cʜᴀɴɴᴇʟs and to plot the Donchian Channels Breakout Signals, enable Sʜᴏᴡ DC Bʀᴇᴀᴋᴏᴜᴛ Sɪɢɴᴀʟs , with 𝐃𝐢𝐬𝐩𝐥𝐚𝐲 𝐈𝐧𝐝𝐢𝐜𝐚𝐭𝐨𝐫 𝐏𝐥𝐨𝐭 (𝐝𝐢𝐬𝐚𝐛𝐥𝐞𝐬 𝐓𝐫𝐚𝐜𝐤𝐞𝐫/𝐒𝐜𝐨𝐫𝐞𝐜𝐚𝐫𝐝) enabled.
Note: Using smoothing factor more than 1 doesn't reflect the actual Donchian Channels Mean line and also impacts the Tracker block colours.
Net Volume and Heikin Ashi Trend
-------------------------------------------------------
Net Volume and Heikin Ashi Trend can be tracked and plotted for up to 10 symbols in addition to the chart symbol, but both Net Volume and Heikin Ashi Trend are not included in the Visual Scorecard. Since the colour of the Net Volume depends on candle being bullish or bearish, it can help the user visualize if the current candle close of the symbol tracked is above or below the symbols's candle open.
Note: Bar Replay doesn't update the bar by bar indicator plot for historic bars for symbols other than the chart symbol. However, the Indicator Plot is perfectly usable for the realtime bar as data updates for both the Trackers and the Scorecard in realtime.
===================================================================================================================
𝗩𝗶𝘀𝘂𝗮𝗹 𝗦𝗰𝗼𝗿𝗲𝗰𝗮𝗿𝗱
=================
Visual Scorecard plots a green Bull or a red Bear Score colour plot for each Indicator from RSI to Donchian Channels Oscillator against every symbol tracked for up to 5 symbols max (First 5 symbols under 𝗧𝗿𝗮𝗰𝗸𝗲𝗿 𝗣𝗹𝗼𝘁𝘀 section). The gap between the scores can be adjusted using gap factor under Gᴀᴘ Fᴀᴄᴛᴏʀ ʙᴇᴛᴡᴇᴇɴ Sᴄᴏʀᴇs dropdown.
Visual Scorecard scoring method
----------------------------------------------------
RSI > 50 - 🟢
RSI < 50 - 🔴
Stoch > 50 - 🟢
Stoch < 50 - 🔴
CCI > 0 - 🟢
CCI < 0 - 🔴
Close price above MA plot - 🟢
Close price below MA plot - 🔴
MACD > 0 - 🟢
MACD < 0 - 🔴
Bollinger Bands %B > 50 - 🟢
Bollinger Bands %B < 50 - 🔴
Ichimoku Bullish Kumo Trend - 🟢
Ichimoku Bearish Kumo Trend - 🔴
Donchian Channels Oscillator > 0 (or close price above DC Mean Line) - 🟢
Donchian Channels Oscillator < 0 (or close price below DC Mean Line) - 🔴
Note: Bar Replay doesn't update the bar by bar scores/tracker data for historic bars for symbols other than the chart symbol. However, the Scorecard is perfectly usable for the realtime bar as data updates for both the Trackers and the Scorecard in realtime.
===================================================================================================================
𝗠𝘂𝗹𝘁𝗶 𝗦𝘆𝗺𝗯𝗼𝗹 𝗧𝗿𝗮𝗰𝗸𝗲𝗿𝘀/𝗟𝗮𝗯𝗲𝗹𝘀
=============================
Multi Symbol Tracker blocks continuously track the real-time indicator data of up to 10 symbols (in addition to the chart symbol) based on the number of Symbol Trackers preferred in the 𝐍𝐮𝐦𝐛𝐞𝐫 𝐨𝐟 𝐒𝐲𝐦𝐛𝐨𝐥 𝐓𝐫𝐚𝐜𝐤𝐞𝐫𝐬 (𝟎-𝟏𝟎) input box under the 𝗧𝗿𝗮𝗰𝗸𝗲𝗿 𝗣𝗹𝗼𝘁𝘀 section, and plots Bull, Bear and Neutral colour coded blocks based on both the indicator selected and settings preferred by the user under the relevant indicator section.
Multi Symbol Tracker Labels also continuously track the real-time indicator data in addition to the last close price (if 𝐒𝐡𝐨𝐰 𝐏𝐫𝐢𝐜𝐞 is enabled under 𝗧𝗿𝗮𝗰𝗸𝗲𝗿 𝗣𝗹𝗼𝘁𝘀 section), which helps user see the real-time changes in the indicator values and price changes of the symbols tracked.
The Tracker Label colours are exactly the same as the Tracker Block colours and are filtered based on the user preferred bands on the Oscillator values. This is slightly different to the Visual Scorecard Colour coding as the range between the user preferred bands is colour coded in a neutral colour, whereas the Scorecard uses only Bull and Bear Colours as explained in the 𝗩𝗶𝘀𝘂𝗮𝗹 𝗦𝗰𝗼𝗿𝗲𝗰𝗮𝗿𝗱 heading above. For example, if the user prefers RSI upper band of 60 and lower band of 40, the range between the values of 40 and 60 will be colour coded in neutral colour which can be changed from the 𝗨𝘀𝗲𝗳𝘂𝗹 𝗘𝘅𝘁𝗿𝗮𝘀 section of the indicator settings.
Note 1: Default settings are based on the Oscillator mid values and hence the Tracker Blocks match with the Visual Scorecard colour codes. Using Upper and Lower bands for oscillators help spot the oversold and overbought zones and also helps spot breakout threshold based on Indicator values specified by the user. Example chart with visual depiction below using RSI.
Note 2: Bar Replay doesn't update the bar by bar scores/tracker data for historic bars for symbols other than the chart symbol. However, the Tracker blocks/labels are perfectly usable for the realtime bar as data updates for both the Trackers and the Scorecard in realtime.
===================================================================================================================
Frequently Asked Questions
========================
Q: When I load the ™TradeChartist Tracker, why are the values in the labels blurred sometimes?
A: This happens occasionally as shown in the chart below, when the script is loaded for the first time or when a different setting is used.
To resolve this, just hide and unhide the script using the 👁 next to the Indicator title. If it is not visible, just hover the mouse/crosshair over the Indicator Title and it will be visible.
Q: Why does the indicator plot, tracker blocks and labels of Symbols being tracked, not update when I use Bar Replay?
A: As explained in the relevant sections above, historic data for bars and indicators other than chart symbol doesn't update on bar replay. But the chart symbol data does update for every bar on bar replay. This doesn't affect the real-time values and block colours for the symbols tracked.
Q: Can I track real-time values of a currently trading symbol when I'm on a symbol chart that is inactive? For example, can I see labels with real-time BTC values on a Sunday when I'm on a SPX chart when its not in session?
A: Simple answer is no. This is because, the plots are based on bar times of the chart and the symbols are tracked based on the bar time. So if the SPX session ended on Friday, the last known value of the BTC labels will be from Friday and hence it is always recommended to track symbols from a symbol chart that is in session.
Q: Does ™TradeChartist Tracker repaint?
A: This indicator doesn't repaint but it is not recommended to trade a different symbol from the chart based on the real-time data alone without checking if the current symbol chart is in session as inactive price chart will not have updated data on symbols tracked. Also, bar replay doesn't work on data pulled from external symbol data than the chart symbol, but signals confirmed at candle close and confirmed by Tracker blocks with appropriate colour code will be in agreement with the respective indicator and can be double checked for building trust and confidence on the indicator.
Q: Can ™TradeChartist Tracker be connected to other indicators as external source?
A: Yes. ™TradeChartist Tracker can be connected to another script and there are several use cases in doing so. A couple of examples are shown below.
1. ™TradeChartist Tracker 's Bollinger Bands %B 𝗜𝗻𝗱𝗶𝗰𝗮𝘁𝗼𝗿 𝗣𝗹𝗼𝘁 connected to ™TradeChartist Plotter to plot Divergences on the 4hr XAU-USD main price chart.
2. ™TradeChartist Tracker 's 𝐁𝐫𝐞𝐚𝐤𝐨𝐮𝐭 𝐓𝐫𝐞𝐧𝐝 𝐈𝐝𝐞𝐧𝐭𝐢𝐟𝐢𝐞𝐫 connected to ™TradeChartist Plug and Trade as Oscillatory Signal with 0/0 to generate trade signals with Targets and performance information on trades.
More Example Charts
==================
===================================================================================================================
Best Practice: Test with different settings first using Paper Trades before trading with real money
===================================================================================================================
This is not a free to use indicator. Get in touch with me (PM me directly if you would like trial access to test the indicator)
Premium Scripts - Trial access and Information
Trial access offered on all Premium scripts.
PM me directly to request trial access to the scripts or for more information.
===================================================================================================================
TE REKABThis indicator is the combination of RECAT & REVVIND published earlier with some extra features.
Core idea behind designing this tool is to IDENTIFY & TRADE REVERSALS in the live market. Reversal can be a TREND REVERSAL or a TEMPORARY PULL BACK. This tool works perfectly in both situations.
LOGIC:
Reversals are identified using:
- failure to break through long term support & resistance, pivots & daily H/L
- volume divergence
- orderflow concept of "skipping of prices".
- flow of price against the momentum during a trend.
Plots are 21/50/100 EMAs which are colour coded to represent the current trend.
ROYAL-BLUE CANDLES represent "ACTION CANDLES"; the high probability candles for finding best reversal trades.
HOW TO USE:
AFTER YOU APPLY THE SCRIPT.
1. WAIT FOR THE FORMATION NEON-BLUE/YELLOW COLOURED BARS AT/NEAR DAY HIGH/LOW.
Accuracy is highest when the REVERSALS are caught at/near DAY HIGH/LOW. I would suggest you to work only on near DAY HIGH/LOW candles.
Do not jump into the trade. Wait for the candle to close.
2. NEON-BLUE represents the start of a BEARISH TREND or simply "SELL SIGNAL".
YELLOW represents the beginning of a BULLISH TREND or simply "BUY SIGNAL".
3. If the NEON-BLUE candle is formed at/near DAY HIGH.
SELL below it's LOW with DAY HIGH as Stoploss. (Keep some BUFFER).
If the YELLOW candle is formed at/near DAY LOW.
BUY above it's HIGH with DAY LOW as Stoploss. (Keep some BUFFER).
4. TARGET
Risk : Reward = 1:1
Trail Stoploss for 1:2, 1:2.5, 1:3
NOTE:
REKAB can be used in any timeframe. However, lower timeframes tend to have more noise as compared to 15mins and above.
REKAB can be used with all the SCRIPTS. However, high volume scripts give better results.
THERE IS ABSOLUTELY NO REPAINTING AFTER THE CANDLE IS CLOSED.
THIS IS A PAID SCRIPT. FOR ACCESS PLEASE SEND A PRIVATE MESSAGE OR WHATSAPP ME (NUMBER IN SIGNATURES)
AS PER TRADINGVIEW POLICY, PLEASE DO NOT ASK FOR ACCESS IN COMMENTS SECTION.
[PX] External LevelHello everyone,
today I'd like to share a script, which enables you to use external logic to plot levels on your chart.
How does it work?
The concept is based on two scripts. One script, which uses an external input as a trigger to print a new level and one script that calculates an output, which will be fetched.
Sounds complicated? It really is not! Let's take a closer look.
// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © paaax
//@version=4
study("RSI OS/OB")
l = input(14, "RSI Length")
ob = input(70, "Overbought")
os = input(30, "Oversold")
r = rsi(close, l)
hline(ob)
hline(os)
plot(r, "RSI", color=color.orange)
// The following plot produces an output, which will be fetched the "External Level"-script.
// It evaluates to one of the following three values: 1.0, -1.0 or 0.0
plot(crossover(r, ob) ? 1.0 : crossunder(r, os) ? -1.0 : 0.0, "Output", transp=100)
The example script above uses an RSI and two threshold levels (70 and 30). The logic here is, that whenever the RSI is crossing down the lower threshold or crossing up the upper threshold we'd consider the current movement to be either oversold or overbought. Therefore, it's a point of interest, which we could visualize with a level.
The script creates an output when the crossover or crossunder of a threshold happens. A crossover would result in a value of 1.0, a crossunder in a value of -1.0. In all other cases the value would be 0.0.
The output of the RSI script would then be used as an input of the External Level script, which has a "Source"-parameter in its input-section. If the fetched input shows 1.0, then the script prints a resistance level. If it shows -1.0 a support level will be printed. And that's basically it. A very simple approach to print levels on your chart with an infinite number of use cases.
For example, you could use fetch outputs from a MACD script, MA script, outputs based on volume or price movement. Just remember the output has to evaluate to either 1.0 or -1.0 and has to be selected in the input-section.
Hope that might be useful to some of you :)
Please click the "Like"-button and follow me for future open-source script publications.
If you are looking for help with your custom PineScript development, don't hesitate to contact me directly here on Tradingview or through the link in my signature :)
Trend Lines Pro for IndicatorsHello Traders!
We need to make things better & better to solve the puzzle and I try to do my best on this way. now I am here with my new Trend Lines Pro for Indicators script.
As you know, Trend Lines is very subjective and many people (even professionals) draw different Trend Lines on the same chart. This is confusing and there must be an automation to make the life easer. with this tool I tried to automate it.
The idea in this script is different from my previous trend lines scripts. In this, I use channel idea so it can check number of pivot points it contains. it also checks the angle while choosing trend lines. then we get stronger and useful Trend Lines automatically.
There are some option in the script, let see one by one:
Indicator: the indicator on which you want to see Trend lines, Predefined Indicators are: RSI, CCI(Commodity Channel Index), OBV(On-Balance Volume), Momentum, MACD, CMF(Chaikin Money Flow), External Indicator
External Indicator: with this option you can use other indicators as input and get trend lines for them.
- First add an indicator (such as MFI)
- in "Indicator" option select "External Indicator"
- click "External Indicator" option
- and choose the indicator from the list
Pivot Period: The Length to calculate Pivot Highs/Lows
Threshold Rate: This rate is used for channel width. it you give bigger numbers then you get bigger channels. it's 4 by default
Minimum Angle Rate for new Trendline: if there are different trend lines , there must be an angle between them to choose best trend lines . you can set the angle with this option.
Minimum Strength: there can be many trend lines but we need to choose/use stronger ones. with this option you can set the number of pivot points a trend channel have to contains. default value is 2
Maximum Loopback Length : by default the script can check 40 pivot highs and 40 pivot lows but to make the script faster and useful I needed to add a limitation for the number of bars that the script can go back.
Show Trendlines as: you can see trend lines as "Trendline", "Channel", "Trend Channel". you can see examples below.
Enable Weak Trend Lines : if there is no trend lines strong enough (as defined in "Minimum Strength" option) you have option to see a weak trend line . that is useful sometimes. if you enable this option weak lines are shown as dotted lines.
Show Price Labels on Trendlines: the script can show the price levels to break trend lines . the example
Line Style: trend lines can be Solid or Dashed as you wish
Color theme: colors of the Up/Down Trend lines can be set. Red, Lime, Blue, White, Black, Olive, Gray
Indicator color: colors of the Up/Down Trend lines can be set. Red, Lime, Blue, White, Black, Olive, Gray and Yellow
and last options are for length options for RSI, CCI, Momentum, MACD, CMF
There are many alerts such: Support/Resistance Broken, Price in Support/Resistance channel, Support/Resistance line broken but still in a channel that means it broke S/R but there is another trend lines to break.
Below an example how the script uses external indicator as input and draws trend lines on it. in this example chaikin ossilator was added to the chart and get trend lines for it. (I am going to make a short video about it)
An example of Trend Channel is below. when you use trend channel option you can get "big picture" of whats going on
An example for trend lines in channels, that is the idea behind this trend lines script
An axample for trend lines for CCI:
Trend lines on OBV:
Trend lines on Momentum:
Trend lines on MACD:
Trend lines on CMF:
Different colors and line styles:
Please send me message for access and do not hesitate to ask your questions about this tool.
Enjoy!
DISCLAIMER: No sharing, copying, reselling, modifying, or any other forms of use are authorized for our documents, script / strategy, and the information published with them. This informational planning script / strategy is strictly for individual use and educational purposes only. This is not financial or investment advice. Investments are always made at your own risk and are based on your personal judgement. I am not responsible for any losses you may incur. Please invest wisely.
Trend Lines ProHello Traders!
We need to make things better & better to solve the puzzle and I try to do my best on this way. now I am here with my new Trend Lines Pro script.
As you know, Trend Lines is very subjective and many people (even professionals) draw different Trend Lines on the same chart. This is confusing and there must be an automation to make the life easer. with this tool I tried to automate it.
The idea in this script is different from my previous trend lines scripts. In this, I use channel idea so it can check number of pivot points it contains, it checks H/L/C in the channels as well. it also checks the angle while choosing trend lines. then we get stronger and useful Trend Lines automatically.
There are some option in the script, let see one by one:
Pivot Period: The Length to calculate Pivot Highs/Lows
Source : Option to use "High/Low" or "Close" as the source for Pivot Points
Threshold Rate : This rate is used for channel width. it you give bigger numbers then you get bigger channels. it's 4 by default
Minimum Angle Rate for new Trendline: if there are different trend lines, there must be an angle between them to choose best trend lines. you can set the angle with this option.
Minimum Strength: there can be many trend lines but we need to choose/use stronger ones. with this option you can set the number of pivot points a trend channel have to contains.
Maximum Loopback Length: by default the script can check 40 pivot highs and 40 pivot lows but to make the script faster and useful I needed to add a limitation for the number of bars that the script can go back.
Show Trendlines as: you can see trend lines as "Trendline", "Channel", "Trend Channel". you can see examples below.
Enable Weak Trend Lines: if there is no trend lines strong enough (as defined in "Minimum Strength" option) you have option to see a weak trend line. that is useful sometimes. if you enable this option weak lines are shown as dotted lines.
Show Price Labels on Trendlines: the script can show the price levels to break trend lines. the examples are below
Line Style: trend lines can be Solid or Dashed as you wish
Color theme: colors of the Up/Down Trend lines can be set. 'Red', Lime, Blue, White, Black, Olive, Gray
you can see the Trend Lines as channels:
you can see Trend Channels to see the big picture.also there is dotted trend line as weak trend line defined above.
you can set color/width of trend lines as you wish.
the script is fast enough to run on 1sec chart:
you can use this script on any chart, fx pairs, stocks, indices etc
I made a short video to explain how to use it and some options:
Please PM for access.
Enjoy!
DISCLAIMER: No sharing, copying, reselling, modifying, or any other forms of use are authorized for our documents, script / strategy, and the information published with them. This informational planning script / strategy is strictly for individual use and educational purposes only. This is not financial or investment advice. Investments are always made at your own risk and are based on your personal judgement. I am not responsible for any losses you may incur. Please invest wisely.
TradeChartist Plug and Trade™TradeChartist Plug and Trade is an extremely useful indicator that can be connected to almost any Study script (not a Strategy) on Trading View (with an Oscillatory or Non-Oscillatory Signal plot) to generate Trade Signals with Stop Loss plot, user set or automatic Target plots and create Alerts based on Past Performance, determined by Past Gains/Drawdowns for each Trade. The indicator is packed with a lot of features including TradeChartist's signature Dashboard and Real-time Gains Tracker, Automatic Targets Generator, Take Profit recommendation, option to paint price bars based on Trade/Price Trend, 3 types of Stop Loss plots to choose from, with option for user to set fixed Target to take profits.
1. How does ™TradeChartist Plug and Trade connect to another Study script/indicator signal?
Plug and Trade is elegantly designed with simplicity in mind, without compromising on functionality, so any trader - beginner to advanced, can just plug an external signal to the indicator with ease by just following these simple steps.
Add to price chart, the Indicator along with the signal plot to be tested and assessed for performance.
Plug the signal into ™TradeChartist Plug and Trade by choosing it from the Plug Signal Here drop-down.
Choose Signal type as Oscillatory if signal oscillates between set values or crosses a certain value periodically (Example: RSI, CCI, TRIX etc that are mostly not overlayed on Price chart and may be in a separate pane from price chart as it may not fit on Price scale), Choose Signal Type as Non Oscillatory if the signal can be plotted on price scale and Trades are normally generated when price crosses above or below it (Moving Averages, SAR indicators like SuperTrend, etc.).
For oscillators, default Oscillator value for Trade Signals is 0 as most Oscillators have 0 as their mid point. The value can be changed if the Signal doesn't oscillate with 0 as its mid point. For example, if the connected Signal is RSI, the values can be changed to Upper and Lower band values to generate Trade Signals.
Plot the Signal on chart if the signal is Non Oscillatory.
2. How can the plugged Signal's performance be assessed using ™TradeChartist Plug and Trade and subsequently used for generating Trade Entries and to create Alerts?
Once the Signal is plugged into the indicator based on steps above, Plug and Trade automatically plots the Trade entries based on the Signal type.
Plot Trade Entries after Bar Close from settings can be checked for signals that do not confirm until bar close. By doing this, repainting can be avoided for most signals and true performance can be assessed. Also, alerts can be created using Once Per Bar rather than Once Per Bar Close .
The real-time Gains Tracker and Dashboard are useful in tracking gains and other useful indicator values like RSI, Stoch, ATR and EMA in real-time with price movement.
Enabling Past Performance from settings will plot Maximum Gains achieved and Maximum Drawdown for each trade as labels . Trading View only plots finite number of labels and old labels are deleted automatically. But to access past performance beyond the last available label, bar replay can be used.
User can choose from 3 types of Stop Losses from the settings - Fixed %, Trailing % and ATR Stop Loss namely and a Fixed TP % to create plots on price chart and to create alerts.
If the user prefers automatic targets based on Trade entries, Recommend Targets can be enabled from the settings. The automatic targets are generated at the time of Trade Entry, along with Target prices and % which turn green when hit.
Each BUY and SELL Trade are tracked in its entirety and the highest high since BUY and lowest low since SELL are plotted on the price chart and also displayed on the Plug and Play Dashboard
Choppiness can be easily spotted if there are numerous Past Performance labels or several Trade Entries around a short timeframe on chart. This may mean that the signal needs smoothing or may not be suitable for the asset to trade on the chart timeframe. Suitability of a Study script for the asset can be determined in many ways using this indicator.
3. What other features are included in ™TradeChartist Plug and Trade?
Enabling Spot Price Bars to take Profit option from settings automatically plots $ sign above/below candles where Profit taking is recommended or Stop Loss moved to secure profits/reduce loss.
Enabling Paint Price Bars with Trade Trend paints price bars with colors that help picture Trade/Price trend. Trend spotting using this works best with (bars/hollow candles/candles with no border) on dark background.
Both features work on Price chart even without any Signal plugged in.
===================================================================================================================
Example Charts using different Signals plugged into ™TradeChartist Plug and Trade
1. RSI Signal (Oscillatory) plugged in with >60 for BUYs and <40 for SELLs - BTC-USDT on 1hr
2. PowerTracer Signal (Oscillatory) plugged in - GBP-USD 1hr
3. 55 period VWMA Signal (Non Oscillatory) plugged in - ADA-USDT 4hr
4. RSI Signal (Oscillatory) plugged in with >70 for BUYs and <30 for SELLs - SPX 1hr with Trailing SL - 3% and TP - 2%
===================================================================================================================
This is not a free to use indicator. Get in touch with me (PM me directly if you would like trial access to test the indicator)
Premium Scripts - Trial access and Information
Trial access offered on all Premium scripts.
PM me directly to request trial access to the scripts or for more information.
===================================================================================================================
Expansion Top/Bottom (Expo) Expansion Top/Bottom (Expo)
DESCRIPTION
Expansion Top/Bottom (Expo) indicator is a powerful oscillator that visualizes temporary Top/Bottom as well as trend shifts. When the market moves boldly a histogram will be formed in the indicator which indicates that the movement might be at its end. It's always a great idea to lock in some profit when we get these histograms. These ‘Lock-in’ profits points are visualized by a cross.
The professional trader has the ability to adjust the length of the calculation. A longer length means that the indicator spots broader market shifts. A short length means that the indicator spots temporary tops/bottoms.
Use the indicator in combination with other signals and analysis techniques.
HOW TO USE
1. Use the indicator to identify temporary tops/bottoms.
2. Use the indicator to identify broader tops/bottoms.
3. Use the indicator to visualize the trend.
4. Use the indicator to visualize ‘Lock-In’ profit points.
INDICATOR IN ACTION
Short length (Length = 14)
BTCUSD
EURUSD
BRENT
BRENT
BTCUSD
Long length (Length = 50)
BRENT
EURUSD
BTCUSD
The indicator works with RENKO, HEIKIN ASHI and with KAGI charts as well.
I hope you find this indicator useful, and please comment or contact me if you like the script or have any questions/suggestions for future improvements. Thanks!
I will continue to work on this indicator, so please share your experience and feedback with me so that I can continuously improve it. Thanks to everyone that have contacted me regarding my scripts. Your feedback is valuable for future developments!
ACCESS THE INDICATOR
• Contact me on TradingView or use the links below.
• I have started to publish private scripts which are not visible on my profile. However, if you're interested to know more about these scripts, drop me a message at my webpage and I will show you these scripts as well. The rationale behind publishing these scrips as private is that I don't want them to be indexed in search engines.
-----------------
Disclaimer
Copyright by Zeiierman.
The information contained in my scripts/indicators/ideas does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, or individual’s trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My scripts/indicators/ideas are only for educational purposes!
Black–Scholes model - Options premium calculatorBlack-Scholes Options Pricing Calculator in Pine Script Introduction
The Black-Scholes model is one of the most widely used mathematical models for pricing options. It provides a theoretical estimate of the price of European-style options based on factors such as the underlying asset price, strike price, time to expiration, volatility, risk-free rate, and option type.
This Pine Script implementation of the Black-Scholes options pricing model enables traders to calculate call and put option prices directly within TradingView, helping them assess potential trades more efficiently.
What Does This Script Do?
This script allows traders to input essential option parameters and instantly calculate both call and put option prices using the Black-Scholes formula. It provides:
• A user-friendly interface for inputting option parameters.
• Automatic computation of option prices.
• Real-time updates as market data changes.
Key Features:
• Uses the Black-Scholes formula to compute European call and put option prices.
• User-defined inputs for stock price, strike price, time to expiration, volatility, and risk-free rate.
• Displays calculated option prices on the TradingView chart.
Understanding the Black-Scholes Formula:
The Black-Scholes model is given by the following equations:
C=S0N(d1)−Xe−rtN(d2)C = S_0 N(d_1) - Xe^{-rt} N(d_2) P=Xe−rtN(−d2)−S0N(−d1)P = Xe^{-rt} N(-d_2) - S_0 N(-d_1)
Where:
• CC = Call option price
• PP = Put option price
• S0S_0 = Current stock price
• XX = Strike price
• rr = Risk-free interest rate
• tt = Time to expiration (in years)
• σ\sigma = Volatility of the stock (annualized)
• N(x)N(x) = Cumulative standard normal distribution
• d1d_1 and d2d_2 are given by:
d1=ln(S0/X)+(r+σ2/2)tσtd_1 = \frac{ \ln(S_0/X) + (r + \sigma^2/2)t }{ \sigma \sqrt{t} } d2=d1−σtd_2 = d_1 - \sigma \sqrt{t}
This script implements these calculations efficiently in Pine Script to help traders quickly determine fair values for options based on current market conditions.
Example Calculation:
(The following example values were true at the time of publishing this script. Option prices fluctuate constantly, so actual values may vary.)
• Underlying asset price (NIFTY): 23,519.35
• ATM Call Strike Price: 23,500
• ATM Put Strike Price: 23,550
• IV (Implied Volatility) for Call Option: 8.1%
• IV (Implied Volatility) for Put Option: 10.1%
• Expiry Date: April 3, 2025
Using the Black-Scholes model, the calculated theoretical prices are:
• Theoretical ATM CE price: ₹129
• Theoretical ATM PE price: ₹118
For comparison, the actual option prices from the option chain table at the time of writing were:
• Actual ATM CE price: ₹139.70
• Actual ATM PE price: ₹120.30
As we can see, there is a larger difference between the theoretical price and actual market price for the ATM Call option compared to the ATM Put option.
If you're an experienced trader, you likely know how to use this kind of information to identify potential market inefficiencies or trading opportunities.
How to Use This Script:
1. Add the script to your TradingView chart.
2. Input the necessary parameters such as stock price, strike price, volatility, risk-free rate, and time to expiration.
3. View the calculated call and put option prices directly on the chart.
This Black-Scholes options pricing calculator provides a convenient way to compute theoretical option prices within TradingView. It helps traders analyse whether an option is fairly priced based on market conditions.
While the Black-Scholes model has its limitations (e.g., it does not account for early exercise of American options or dividend payments), it remains a powerful tool for European-style options pricing and a foundational concept in financial markets.
A handy little tool! Unfortunately, this script requires manual data entry since automatic data capture is currently not possible. If this ever becomes feasible in the future, an updated version will be released.
Try it out and let me know your feedback!
Disclaimer:
Please note that this is only for study/educational purpose and is just one of the many tools a trader may use.
Use it at your own risk.
Regards!
Watchlist & Symbols Distribution [Daveatt]TLDR;
I got bored so I just coded the TradingView watchlist interface in Pinescript :)
TLDR 2:
Sharing it open-source what took me 1 full day to code - haven't coded in Pinescript in a long time, so I'm a bit slow for now :)
█ OVERVIEW
This script offers a comprehensive market analysis tool inspired by TradingView's native watchlist interface features.
It combines an interactive watchlist with powerful distribution visualization capabilities and a performance comparison panel.
The script was developed with a focus on providing multiple visualization methods while working within PineScript's limitations.
█ DEVELOPMENT BACKGROUND
The pie chart implementation was greatly inspired by the ( "Crypto Map Dashboard" script / )
adapting its circular visualization technique to create dynamic distribution charts. However, due to PineScript's 500-line limitation per script, I had to optimize the code to allow users to switch between pie chart analysis and performance comparison modes rather than displaying both simultaneously.
█ SETUP AND DISPLAY
For optimal visualization, users need to adjust the chart's display settings manually.
This involves:
Expanding the indicator window vertically to accommodate both the watchlist and graphical elements
Adjusting the Y-axis scale by dragging it to ensure proper spacing for the comparison panel grid
Modifying the X-axis scale to achieve the desired time window display
Fine-tuning these adjustments whenever switching between pie chart and comparison panel modes
These manual adjustments are necessary due to PineScript's limitations in controlling chart scaling programmatically. While this requires some initial setup, it allows users to customize the display to their preferred viewing proportions.
█ MAIN FEATURES
Distribution Analysis
The script provides three distinct distribution visualization modes through a pie chart.
Users can analyze their symbols by exchanges, asset types (such as Crypto, Forex, Futures), or market sectors.
If you can't see it well at first, adjust your chart scaling until it's displayed nicely.
Asset Exchanges
www.tradingview.com
Asset Types
Asset Sectors
The pie charts feature an optional 3D effect with adjustable depth and angle parameters. To enhance visual customization, four different color schemes are available: Default, Pastel, Dark, and Neon.
Each segment of the pie chart includes interactive tooltips that can be configured to show different levels of detail. Importantly, the pie chart only visualizes the distribution of selected assets (those marked with a checkmark in the watchlist), providing a focused view of the user's current interests.
Interactive Watchlist
The watchlist component displays real-time data for up to 10 user-defined symbols. Each entry shows current price, price changes (both absolute and percentage), volume metrics, and a comparison toggle.
The table is dynamically updated and features color-coded entries that correspond to their respective performance lines in the comparison chart. The watchlist serves as both an information display and a control panel for the comparison feature.
Performance Comparison
One of the script's most innovative features is its performance comparison panel.
Using polylines for smooth visualization, it tracks the 30-day performance of selected symbols relative to a 0% baseline.
The comparison chart includes a sophisticated grid system with 5% intervals and a dynamic legend showing current performance values.
The polyline implementation allows for fluid, continuous lines that accurately represent price movements, providing a more refined visual experience than traditional line plots. Like the pie charts, the comparison panel only displays performance lines for symbols that have been selected in the watchlist, allowing users to focus on their specific assets of interest.
█ TECHNICAL IMPLEMENTATION
The script utilizes several advanced PineScript features:
Dynamic array management for symbol tracking
Polyline-based charting for smooth performance visualization
Real-time data processing with security calls
Interactive tooltips and labels
Optimized drawing routines to maintain performance
Selective visualization based on user choices
█ CUSTOMIZATION
Users can personalize almost every aspect of the script:
Symbol selection and comparison preferences
Visual theme selection with four distinct color schemes
Pie chart dimensions and positioning
Tooltip information density
Component visibility toggles
█ LIMITATIONS
The primary limitation stems from PineScript's 500-line restriction per script.
This constraint necessitated the implementation of a mode-switching system between pie charts and the comparison panel, as displaying both simultaneously would exceed the line limit. Additionally, the script relies on manual chart scale adjustments, as PineScript doesn't provide direct control over chart scaling when overlay=false is enabled.
However, these limitations led to a more focused and efficient design approach that gives users control over their viewing experience.
█ CONCLUSION
All those tools exist in the native TradingView watchlist interface and they're better than what I just did.
However, now it exists in Pinescript... so I believe it's a win lol :)
Supertrend Alert with Arrows and Time FilterOverview
This script is designed to generate trading signals based on the Supertrend indicator, a popular technical analysis tool. The Supertrend indicator is used to identify the direction of the market trend and potential reversal points.
Supertrend Settings
The script uses two sets of Supertrend settings:
Small Supertrend
Factor: 3.0
ATR Period: 10
Big Supertrend
Factor: 10.0
ATR Period: 30
These settings are fixed and should not be altered to maintain the integrity of the signal generation process.
Configurable Parameters
startHour: The hour at which signal generation begins.
endHour: The hour at which signal generation ends.
These parameters allow users to focus on specific trading hours, optimizing the signal relevance to their trading strategy.
Signal Types
The script generates two types of signals:
Type 1: Reversal Signal
Long Signal: Triggered when the big Supertrend is in an uptrend, and the small Supertrend transitions from a downtrend to an uptrend.
Short Signal: Triggered when the big Supertrend is in a downtrend, and the small Supertrend transitions from an uptrend to a downtrend.
Type 2: Trend Change Signal
Long Signal: Triggered when the big Supertrend changes from a downtrend to an uptrend.
Short Signal: Triggered when the big Supertrend changes from an uptrend to a downtrend.
How the Script Works
Initialization: The script initializes with predefined Supertrend settings.
Data Input: Market data (e.g., price data) is fed into the script.
Supertrend Calculation: The script calculates the Supertrend values using the predefined factors and ATR periods.
Signal Detection: The script monitors the Supertrend values and detects the defined signals based on the conditions mentioned above.
Time Filtering: Signals are filtered based on the specified startHour and endHour, ensuring only relevant signals are displayed within the desired timeframe.
Usage
Set Parameters: Define startHour and endHour according to your trading schedule.
Run Script: Execute the script with market data input.
Interpret Signals: Monitor the generated signals and use them to inform your trading decisions.
Originality
Dual Supertrend Usage: The use of both a small and a big Supertrend to generate signals adds a layer of complexity and reliability to the signals.
Time-Based Filtering: Allows traders to focus on specific trading hours, enhancing the relevance and accuracy of signals.
Two Signal Types: The combination of reversal signals and trend change signals provides comprehensive market insights.
Conclusion
This Supertrend Signal Generator is a robust tool for traders seeking to leverage the Supertrend indicator for more informed trading decisions. By combining dual Supertrend settings and configurable trading hours, the script offers unique and flexible signal generation capabilities.
Waves MultiTimeframe AlfredThe price on the charts moves quite chaotically, but when we look at a given interval (and eliminate the noise created on the lower interval), we can distinguish trend price movements up and down. They are almost never a straight line, but the price reaches higher and higher lows - we have up trend or lower and lower highs when we have a down trend.
There are many theories trying to describe trend movements, and many trend change detectors have been created on their basis.
In last centry we we had few famous researchers of investment theories, one of them was the Japanese journalist and investor Goichi Hosoda, creator of Ichimoku trading theory.
Goichi Hosoda proposed a trend change detector called Kyushu Legs. This detector compares the values of the current price with the price from 9 weeks ago and illustrates them using a candlestick chart. Than on the chart we can distinguishes B, P, Y formations that allow us to determine the trend and notify about trend change moment. This idea was developed further. The set of Kyushu Legs formations (B, P, Y) has been transferred to raw price chart and transformed into a set of rules detecting trend changes on the current price chart. A unique feature this method is the comparison of the parameters of neighboring candles in order to dynamically determine the values beyond which the trend changes. This eliminate the need of predefined threshold values and adjusting it to different price ranges.
Described trend detector is available on TradingView under the name "Waves" and was a starting point of a whole package of "Waves" scripts built around this detector.
"Waves MultiTimeframe Alfred" is part of the "Waves" package. It is an extension of trend detector with the ability to analyze in parallel candle data taken from higher intervals. Thanks to that this detector detects moments of trend changes on many intervals at once.
In top-right corner it displays a window with basic informations about trend (and potencial trend change moment) at higher intervals, such as:
- Trend direction confirmed on last closed candle
- In real time trend direction with the assumption that candle will be closes at current price level.
- Time to current candle close
- Price change done by the current candle
- Price's distance to the trend change threshold
Trend direction and potencial trend change are shown with a symbols:
↗ - Continuation of up trend
↘ - Continuation of down trend
↺ - Trend change to up trend
↷ - Trend change to down trend
This script supports 2 trend detection rulesets:
- Low - More sensitive trend detection ruleset, detects changes faster and more often than Medium, announcing potential changes in the Medium trend
- Medium - Less sensitive trend detection ruleset detecting trends on the chart.
Remember, until candle is not close price can move and trend indication can change. All trend indicators have a delay and are describing past till now. Future prediction cannot be done by software.
This script can be used alone, but the creator's intention was to use it together with other scripts from the "Waves" package. e.g. It can be used with the "Waves" script which draw trend lines and trend change moments on the current interval and we can use "Waves MultiTimeframe Alfred" as an assistant showing basic trends situation on up to 3 higher intervals.
Script settings:
Timeframe 1,2,3 - Option to pick 3 higher timeframes with text and background color settings.
Timer - Showing count down timer to the end of current bar on that interval
Candles - Showing candle symbol with current price change done on that interval. A separate candle color can be picked for price up and down candles.
Low wave row - Row with low trend symbol and price distance to the current low trend threshold (trend change price).
↗ - Continuation of up trend
↘ - Continuation of down trend
↺ - Trend change to up trend
↷ - Trend change to down trend
Low wave last bar symbol - Symbol of trend confirmed by previous bar. Drawn in the first line before interval symbol:
↗ - up trend
↘ - down trend
Mid wave row - Row with mid trend symbol and price distance to the current mid trend threshold (trend change price).
↗ - Continuation of up trend
↘ - Continuation of down trend
↺ - Trend change to up trend
↷ - Trend change to down trend
Mid wave last bar symbol - Symbol of trend confirmed by previous bar. Drawn in the first line after interval symbol:
↗ - up trend
↘ - down trend
Warnings - Showing explanation messages when interval data are not available.
Signal change - Experimental option to signal trend change with a different color.
Troubleshooting:
In case of any problems, please send error details to the author of the script.
dashboard MTF,EMA User Guide: Dashboard MTF EMA
Script Installation:
Copy the script code.
Go to the script window (Pine Editor) on TradingView.
Paste the code into the script window.
Save the script.
Adding the Script to the Chart:
Return to your chart on TradingView.
Look for the script in the list of available scripts.
Add the script to the chart.
Interpreting the Table:
On the right side of the chart, you will see a table labeled "EMA" with arrows.
The rows correspond to different timeframes: 5 minutes (5M), 15 minutes (15M), 1 hour (1H), 4 hours (4H), and 1 day (1D).
Understanding the Arrows:
Each row of the table has two columns: "EMA" and an arrow.
"EMA" indicates the trend of the Exponential Moving Average (EMA) for the specified period.
The arrow indicates the direction of the trend: ▲ for bullish, ▼ for bearish.
Table Colors:
The colors of the table reflect the current trend based on the comparison between fast and slow EMAs.
Blue (▲) indicates a bullish trend.
Red (▼) indicates a bearish trend.
Table Theme:
The table has a dark (Dark) or light (Light) theme according to your preference.
The background, frame, and colors are adjusted based on the selected theme.
Usage:
Use the table as a quick indicator of trends on different timeframes.
The arrows help you quickly identify trends without navigating between different time units.
Designed to simplify analysis and avoid cluttering the chart with multiple indicators.
Elliot wavesA script marking Elliot waves on a chart.
This script can be used by any user. There is no need to have a PRO or PREMIUM account.
Script with limited access, contact author to get authorization
According to Elliott, a market cycle consists of eight waves. 5 upward waves and 3 downward waves following them, which are their corrections. In up and down movements, the odd waves are in the direction of the movement, and the even waves are their corrections. Analyzing in more detail, each direction movement again consists of 5 waves, and each correction consists of 3 waves.
The symbols used are non-standard (result of platform limitations):
Trend moves ⠀⠀⠀⠀⠀|⠀⠀Correction moves
𝐈 𝐈𝐈 𝐈𝐈𝐈 𝐈𝐕 𝐕 ⠀⠀⠀⠀⠀ |⠀⠀⠀ 𝐚 𝐛 𝐜
𝟏 𝟐 𝟑 𝟒 𝟓 ⠀⠀⠀⠀⠀⠀⠀|⠀⠀⠀ 𝐀 𝐁 𝐂
I II III IV V ⠀⠀⠀⠀⠀⠀⠀|⠀⠀⠀ a b c
1 2 3 4 5 ⠀⠀⠀⠀⠀⠀⠀ |⠀⠀⠀ A B C
(I) (II) (III) (IV) (V) ⠀ |⠀⠀⠀(a) (b) (c)
(1) (2) (3) (4) (5)⠀⠀ |⠀⠀⠀(A) (B) (C)
➀ ➁ ➂ ➃ ➄ ⠀⠀⠀⠀⠀ |⠀⠀⠀Ⓐ Ⓑ Ⓒ
❶ ❷ ❸ ❹ ❺ ⠀⠀⠀⠀⠀ |⠀⠀⠀🅐 🅑 🅒
This script is a part of the "Elliot waves" toolkit and require initial calibration done with separate script: "Elliot waves calibrator". Elliot waves calibrator will generate a set of numbers that you need to copy to Calibration params in script settings. Proper instruction will be shown on the screen.
Script settings:
Calibration - Fields used for script calibration.
Levels - Param deciding how many levels of waves should be shown on the chart. 0 is showing only the main waves, with +1 increase adding one more level of details.
Vertex filter - Filter eliminating highs and lows that are not an extreme over area width equal to vertex filter value.
8 sets of trend configurations, where you can specify: visiblity, line color, line width
Labels configuration where you can specify: visiblity, text size and text color.
Troubleshooting:
In case of any problems, please send error details to the author of the script.
Premium Volatility Breakout Strategy [wbburgin]This the premium version of my Volatility Breakout strategy, which improves significantly on the original strategy (publicly available on my profile). Improvements are below. A note about any of my premium scripts: I will continue updating and improving the original (public) versions.
This strategy is not built for any specific asset or timeframe, and has been backtested on crypto, equities, and forex from 1min - 1day. However, I recommend using it on more volatile assets because it is a breakout strategy.
********** My Background
I am an investor, trader, and entrepreneur with 10 years of cryptocurrency and equity trading experience and founder of two fintech startups. I am a graduate of a prestigious university in the United States and carry broad and inclusive interests in mathematical finance, computer science, machine learning / artificial intelligence, as well as other fields.
**********
Improvements over the original Volatility Breakout strategy include:
Faster Trend Detection → The Premium Volatility Breakout strategy will catch trends faster by using adaptive volatility-weighted bands instead of standard-width volatility-weighted bands. This can improve win size and has performed well in my backtesting.
ADX Filter → False breakouts dampen the overall results of the original script, as well as the % profitable,so an ADX filter has been programmed into the script (toggle on/off in settings). This filter will only enter long and short trades when the ADX is above a certain threshold. This is by default toggled off because in most instances it will not be necessary, but in certain environments may be useful.
MA Configuration → Different types of moving averages and weights are now configurable in the settings. These can change the responsiveness of the strategy.
External Trend Filter → I use this strategy as a filter for some of my low-timeframe algorithms. I have added an external trend filter (a plot only displayed in the data window) that will return “1” when the trend is long and “-1” when the trend is short (displayed on-chart with red and green trend curves).
Customizable Alert Messages In-Strategy → In the settings, there will be text boxes where you can create your own alerts. All you will need to do is create an alert in the alert panel on TradingView and leave the message box blank - if you fill out the alert boxes in the settings, these will automatically populate into your alerts. There are in total four different customizable alerts messages: Entry and Exit alerts for both Long and Short sides. If you disable stop loss and/or take profit, these alerts will also be disabled. Similarly, if you disable shorts, all short alerts will be disabled.
About stop losses: This strategy does not come with a stop loss because the moving average acts as a stop loss / trade exit for both long and short entries.
**********
Display
You can turn off highlighting or barcolor in the settings. Additionally, future updates may include a color scheme for users using a light-themed window.
**********
Configuring Alerts
In TradingView desktop, go to the ‘Alerts’ tab on the right panel. Click the “+” button to create a new alert. Select this strategy for the condition and one of the two options that includes alert() function calls. Name the alert what you wish and clear the default message, because your text in the settings will replace this message.
Now that the alert is configured, you can go to the settings of the strategy and fill in your chosen text for the specific alert condition. You will need to check “Long and Short” in the “Trade Direction” setting in order for any Short Alerts to become active.
**********
Disclaimer
Copyright by wbburgin.
The information contained in my Scripts/Indicators/Algorithms does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
Auto Harmonic Pattern - Backtester [Trendoscope]We are finally here with the implementation of backtesting tool for Auto-Harmonic-Pattern-UltimateX .
CAUTION: THIS IS NOT A STRATEGY AND SHOULD NOT BE FOLLOWED BLINDLY. WE ENCOURAGE USERS TO UTILISE THIS AS BACKTESTING TOOL FOR BUILDING THEIR STRATEGY BASED ON HARMONIC PATTERNS
This script is based on our premium indicator - Auto-Harmonic-Pattern-UltimateX . In this script, along with implementation of scanning harmonic patterns, we provide various options via settings which enables users to build their own strategy based on harmonic patterns, use them with custom coded filters, backtest them on various tickers and timeframes.
Harmonic Patterns is concept and we can trade harmonic pattern in many ways. While general interest around harmonic patterns is to find reversal zones and use them for short term swing trades. But, using it along trend following strategies can also be very rewarding. Here is one of the educational idea I shared about using harmonic patterns for trend following. These are just few possibilities where users can explore further on how they want to trade this. The settings of this script are crafted in such a way that it enables users to explore all these possibilities.
🎲 Components
Chart components of this script is lighter compared to Auto Harmonic Pattern - UltimateX. This is because we want to keep lighter interface in order to support seamless execution of emulator. Since pine strategy framework does most of the things such as calculating profitability, keeping track of trades and results etc, display with respect to - "Closed Trade Stats" are removed from this script and "Open Trade Stats" are made lighter.
🎲 Settings
🎯 Trade Settings : Few important settings under this section are
Due to pine limitations, we will not be able to support both long and short in a same setup. Hence, users need to chose either long or short trade setup.
Entry/Base/Target play important role in defining your strategy.
Confluence is another important factor which lets users use multiple patterns at once as confirmation.
🎯 Zigzag Settings : Zigzag settings determine the size of patterns being formed.
Please note that smaller patterns may not yield very good results and larger patterns may take time to complete trade. Similarly higher depth can cause runtime issues. Recursive zigzag option is alternative to deep search algorithm.
🎯 Filters :
Filters enable users to select trades based on specific conditions. Ability to use external filter even allows writing and using custom filters to be used with this algorithm. Here is a video which explains how this can be done. HOW-TO-Use-external-filters
Pattern filters allow users to pick and chose patterns they want to trade. This can be done either individually or based on category
🎯 Alerts :
Apart from strategy specific alerts, the script also implements customisable alerts via pine alert() function. Alerts can be configured to send upon three conditions
When new pattern is created
When an existing pattern updates entry/stop/target due to safe repaint of D (Only happens when Trail Entry Price is selected)
When a pattern in trade closes either due to hitting stop or target
Important Note: Alerts fired via this method may not match the trades shown on chart as trades which are controlled via pine strategy emulator depends on various other factors such as pyramiding.
Alert template is customisable and users can make use of available placeholders to get dynamic data in alerts. Valid placeholders are
{alertType} - Alert type - New/Update/Close
{id} - Pattern Id
{ticker} - Ticker
{timeframe} - Chart timeframe
{price} - Current price
{patterns} - Identified pattern names
{direction} - Direction - Long/Short
{entry} - Entry Price
{stop} - Stop Price
{target} - Target Price
{orderType} - Limit/Stop - applicable for only New and Update types
{status} - Trade status. Valid values are Pending/Cancelled/Stopped/Success
Template is common for all custom alert types. Hence, updating the template will impact all custom alerts - New/Update/Close
{
"alert" : "{alertType}",
"id" : {id},
"ticker" : "{ticker}",
"timeframe" : "{timeframe}",
"price" : {price},
"patterns" : "{patterns}",
"direction" : "{direction}",
"entry" : {entry},
"stop" : {stop},
"target" : {target},
"orderType" : {orderType}
"status" : {status}
}
Here is a video on how to customise the alerts using templates and placeholders - HOW-TO-Customize-Alerts-With-Placeholders
🎯 Miscellaneous :
These are simple settings to control display and backtest bars. If you are running alerts, we suggest turning of Open Trades and Drawings and limit backtest to minimal value in order to improve efficiency of
🎯 Backtest Engine Parameters :
Default settings are optimised for trend following. Users are encouraged to play around with settings and filters to build strategy out of this tool.
Position sizing is not leveraged. Margin settings makes sure that trades cannot exceed capital.
All measures are taken to avoid repainting. Script does not use request.security and real time bars. This drastically reduces the risk of repainting in scripts.
If you are premium user, please select "Bar Magnifier".
Strategy BackTest Display Statistics - TraderHalaiThis script was born out of my quest to be able to display strategy back test statistics on charts to allow for easier backtesting on devices that do not natively support backtest engine (such as mobile phones, when I am backtesting from away from my computer). There are already a few good ones on TradingView, but most / many are too complicated for my needs.
Found an excellent display backtest engine by 'The Art of Trading'. This script is a snippet of his hard work, with some very minor tweaks and changes. Much respect to the original author.
Full credit to the original author of this script. It can be found here: www.tradingview.com
I decided to modify the script by simplifying it down and make it easier to integrate into existing strategies, using simple copy and paste, by relying on existing tradingview strategy backtester inputs. I have also added 3 additional performance metrics:
- Max Run Up
- Average Win per trade
- Average Loss per trade
As this is a work in progress, I will look to add in more performance metrics in future, as I further develop this script.
Feel free to use this display panel in your scripts and strategies.
Thanks and enjoy :)
Tick travel ⍗This script is a further exploration of 'ticks' (only on realtime - live bars), based on my previous script:
- www.tradingview.com -
What are 'ticks'?
... Once the script’s execution reaches the rightmost bar in the dataset, if trading is currently active on the chart’s symbol,
then Pine indicators will execute once every time an update occurs, i.e., price or volume changes ...
(www.tradingview.com)
This script has 2 parts:
1) Option: ' Tick up/down'
This is a further progression of previous work.
During bar development, every time there is an update (tick), a dot is placed.
If for example there is 1 tick (first of new bar), a dot will be placed on 1,
if it is the 8th tick off that bar, there will be a dot placed on 8.
While my previous script had the issue that there was an upper limit per bar (max 32),
this script (because it is working with labels) can place max 500 dots.
For each bar this is better, it has to be mentioned though that looking in history, once the limit of 500 has been reached,
you'll notice the last ones are being deleted. This is one of the reasons the script is not suitable for higher timeframes
(1h and higher, even higher than 5 minutes can give some issues if it is a highly traded ticker), if a bar would have more
than 500 ticks, they won't be drawn anymore (which is not desirable of course)
2) Option: ' Tick progression'
These are the same ticks, but placed on the candle itself, or you can show the candle:
Or 'without' candle (or 'black' colour):
When 'No candles' are enabled, the 'candles' get the colour at the right.
At the moment it is not possible to drawn between 2 candles, this technique uses labels with 'text',
each tick on a candle will have a 'space' added, so you can see a progression to the right.
Colours
- if price is higher than previous tick price -> green
- if price is lower than previous tick price -> red
- otherwise -> blue (dimmed)
There are options to choose the 'dot', when choosing 'custom',
just enter (copy/paste) your symbol of your choice in the 'custom' field:
Caveats:
- Labels and text will not always be exactly on the price itself
- The scripts needs more testings, possibly some ticks don't always get drawn as they should.
The lower the timeframe, the more possible issues can occur
- Since (candle option) the dots move to the right, the higher the timeframe and/or the more ticks,
the sooner ticks will go in the area of next candle.
That's why I made a separate 'start symbol'
-> This is the very first tick on each candle, then you can zoom in/out more easily until the dots don't merge into each other candle area:
A timeframe higher than 5 minutes mostly won't be feasible I believe
This script wouldn't be possible without the help of @LucF, also because of his script
With very much respect I am hugely inspired by him! Many Thanks to him, Tradingview, and everything associated with them!
Cheers!
Dynamic Fib StrategyAfter publishing many complex scripts with a myriad of inputs that were confusing for the average user, and after being told my previous publications were overfitted and not easily applied across the board...I spent the past three months working on this masterpiece.
The script is very simple to use, and it MUST be used for timeframes of 10 minutes or more. Please do not use this strategy for lower timeframes thinking that more trades is a desireable trait in a strategy. Patience is a virtue, and it doesn't matter if there are 1000 bars between trades (I am exaggerating here) all crypto is cyclical in a short timeframe of days.
The script is based on moving averages, what is different about this script is that it is the result of months of analysis of the crosses that are key indicators of the best times to trade. It also identifies crosses that indicate when a massive dump is coming and when the dump turns back into a pump. It is designed to be a long strategy with the careful identification of the dump indicators so it preserves your capital and results in a better trade approach.
At the heart of this script is the Sutte MA and the SMA, and only a subset of the settings for these are exposed for user input to keep things simple.
The second key piece of how this script works is the Fibonnaci levels. For the purposes of using this script, the first two levels (Fib 1 and Fib 2) are only for display purposes of the bands and does not affect the triggers for trading. It is only the third and fourth levels which impact the trade triggerers for buying and selling. The idea here is that the best times to execute a trade is when the price moves into the outer bands as these are typical triggers for selloffs from those suffering from FOMO.
Since I have done quite a bit of work here, I do not wish for this script to be copied and pasted into other scripts. It is my coup de grace and there is not a script like this anywhere on TradingView that delves deep into the crosses that matter.
logLibrary "log"
Logging library for easily displaying debug, info, warn, error and critical messages.
No real need to explain why you might want to use this library! I'm sure you've all experienced the frustration of trying to understand the data state of your scripts... so, enjoy! More on it's way...
(Don't forget to check the helpers in the script and the useful tips below)
Some Useful Tips
By default the log console persists between bars (for history) and bars and ticks (for realtime).
Sometimes it is useful to clear the log after each candle or tick (assuming we are using the above helpers):
```
log_print(clear = true) // starts afresh on every bar and tick (excludes historical bars but good realtime tick analysis)
log_print(clear = barstate.isnew) // clears the log at the start of each bar (again, excludes historical but good realtime candle analysis)
```
It is also useful to be able to selectively understand the state of data at specific points or times within a script:
```
if log.once()
debug('useful variable', my_var) // this log only gets written once, upon first execution of this statement
if log.only(5)
debug3(a, b, c) // these variables are only logged the first five times this statement is executed
log_print(clear = false) // clear must be false and you should not write other logs on every bar, or the above will be lost
```
Final tip. If you want to view ONLY log entries of a particular level, then negate the constant:
```
log_print(level = -LOG_DEBUG)
```
Detailed Interface
once() Restrict execution to only happen once. Usage: if assert.once()\n happens_once()
Returns: bool, true on first execution within scope, false subsequently
only(repeat) Restrict execution to happen a set number of times. Usage: if assert.only(5)\n happens_five_times()
Parameters:
repeat : int, the number of times to return true
Returns: bool, true for the set number of times within scope, false subsequently
init() Initialises the log array
Returns: string , tuple based array to contain all pending log entries (__LOG)
clear(msgs) Clears the log array
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
trace(msgs, msg) Writes a trace message to the log console
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
msg : string, the trace message to write to the log
debug(msgs, msg) Writes a debug message to the log console
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
msg : string, the debug message to write to the log
info(msgs, msg) Writes an info message to the log console
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
msg : string, the info message to write to the log
warn(msgs, msg) Writes a warning message to the log console
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
msg : string, the warn message to write to the log
error(msgs, msg) Writes an error message to the log console
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
msg : string, the error message to write to the log
fatal(msgs, msg) Writes a critical message to the log console
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
msg : string, the fatal message to write to the log
log(msgs, level, msg) Write a log message to the log console with a custom level
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
level : ing, the logging level to assign to the message
msg : string, the log message to write to the log
severity(msgs) Checks the unprocessed log messages and returns the highest present level
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
Returns: int, the highest level found within the unfiltered logs
print(msgs, level, clear, rows, text_size, position) Prints all log messages to the screen
Parameters:
msgs : string , the current collection of unfiltered and unprocessed logs (__LOG)
level : int, the minimum required log level of each message to be displayed
clear : bool, clear the printed log console after each render (useful with realtime when set to barstate.isconfirmed)
rows : int, the number of rows to display in the log console
text_size : string, the text size of the log console (global size vars)
position : string, the position of the log console (global position vars)
unittest_log(case) Log module unit tests, for inclusion in parent script test suite. Usage: log.unittest_log(__ASSERTS)
Parameters:
case : string , the current test case and array of previous unit tests (__ASSERTS)
unittest(verbose) Run the log module unit tests as a stand alone. Usage: log.unittest()
Parameters:
verbose : bool, optionally disable the full report to only display failures
assertLibrary "assert"
Production ready assertions and auto-reporting for unit testing pine scripts.
This library was born from the need to maintain production level stability and catch regressions / bugs early and fast. I hope this help you trust your pine scripts too. More libraries and tools on their way... please follow for more.
Please see the script for helpers to copy into your own scripts as well as examples at the bottom of the library unit testing itself.
Quick Reference
```
case = assert.init()
new_case(case, 'Asserts for floats and ints')
assert.equal(a, b, case, 'a == b')
assert.not_equal(a, b, case, 'a != b')
assert.nan(a, case, 'a == na')
assert.not_nan(a, case, 'a != na')
assert.is_in(a, b, case, 'a in b ')
assert.is_not_in(a, b, case, 'a not in b ')
assert.array_equal(a, b, case, 'a == b ')
new_case(case, 'Asserts for ints only')
assert.int_in(a, b, case, 'a in b ')
assert.int_not_in(a, b, case, 'a not in b ')
assert.int_array_equal(a, b, case, 'a == b ')
new_case(case, 'Asserts for bools only')
assert.is_true(a, case, 'a == true')
assert.is_false(a, case, 'a == false')
assert.bool_equal(a, b, case, 'a == b')
assert.bool_not_equal(a, b, case, 'a != b')
assert.bool_nan(a, case, 'a == na')
assert.bool_not_nan(a, case, 'a != na')
assert.bool_array_equal(a, b, case, 'a == b ')
new_case(case, 'Asserts for strings only')
assert.str_equal(a, b, case, 'a == b')
assert.str_not_equal(a, b, case, 'a != b')
assert.str_nan(a, case, 'a == na')
assert.str_not_nan(a, case, 'a != na')
assert.str_in(a, b, case, 'a in b ')
assert.str_not_in(a, b, case, 'a not in b ')
assert.str_array_equal(a, b, case, 'a == b ')
assert.report(case)
```
Detailed Interface
once() Restrict execution to only happen once. Usage: if assert.once()\n happens_once()
Returns: bool, true on first execution within scope, false subsequently
init() Initialises the asserts array
Returns: string , tuple based array containing all unit test results and current case details (__ASSERTS)
equal(a, b, case, name) Numeric assert equal. Usage: assert.equal(1, 1, case, 'one == one')
Parameters:
a : float, numeric value "a" to compare equal to "b"
b : float, numeric value "b" to compare equal to "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
not_equal(a, b, case, name) Numeric assert not equal. Usage: assert.not_equal(1, 2, case, 'one != two')
Parameters:
a : float, numeric value "a" to compare not equal "b"
b : float, numeric value "b" to compare not equal "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
nan(a, case, name) Numeric assert is NaN. Usage: assert.nan(float(na), case, 'number is NaN')
Parameters:
a : float, numeric value "a" to check is NaN
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
not_nan(a, case, name) Numeric assert is not NaN. Usage: assert.not_nan(1, case, 'number is not NaN')
Parameters:
a : float, numeric value "a" to check is not NaN
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
is_in(a, b, case, name) Numeric assert value in float array. Usage: assert.is_in(1, array.from(1.0), case, '1 is in ')
Parameters:
a : float, numeric value "a" to check is in array "b"
b : float , array "b" to check contains "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
is_not_in(a, b, case, name) Numeric assert value not in float array. Usage: assert.is_not_in(2, array.from(1.0), case, '2 is not in ')
Parameters:
a : float, numeric value "a" to check is not in array "b"
b : float , array "b" to check does not contain "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
array_equal(a, b, case, name) Float assert arrays are equal. Usage: assert.array_equal(array.from(1.0), array.from(1.0), case, ' == ')
Parameters:
a : float , array "a" to check is identical to array "b"
b : float , array "b" to check is identical to array "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
int_in(a, b, case, name) Integer assert value in integer array. Usage: assert.int_in(1, array.from(1), case, '1 is in ')
Parameters:
a : int, value "a" to check is in array "b"
b : int , array "b" to check contains "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
int_not_in(a, b, case, name) Integer assert value not in integer array. Usage: assert.int_not_in(2, array.from(1), case, '2 is not in ')
Parameters:
a : int, value "a" to check is not in array "b"
b : int , array "b" to check does not contain "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
int_array_equal(a, b, case, name) Integer assert arrays are equal. Usage: assert.int_array_equal(array.from(1), array.from(1), case, ' == ')
Parameters:
a : int , array "a" to check is identical to array "b"
b : int , array "b" to check is identical to array "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
is_true(a, case, name) Boolean assert is true. Usage: assert.is_true(true, case, 'is true')
Parameters:
a : bool, value "a" to check is true
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
is_false(a, case, name) Boolean assert is false. Usage: assert.is_false(false, case, 'is false')
Parameters:
a : bool, value "a" to check is false
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
bool_equal(a, b, case, name) Boolean assert equal. Usage: assert.bool_equal(true, true, case, 'true == true')
Parameters:
a : bool, value "a" to compare equal to "b"
b : bool, value "b" to compare equal to "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
bool_not_equal(a, b, case, name) Boolean assert not equal. Usage: assert.bool_not_equal(true, false, case, 'true != false')
Parameters:
a : bool, value "a" to compare not equal "b"
b : bool, value "b" to compare not equal "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
bool_nan(a, case, name) Boolean assert is NaN. Usage: assert.bool_nan(bool(na), case, 'bool is NaN')
Parameters:
a : bool, value "a" to check is NaN
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
bool_not_nan(a, case, name) Boolean assert is not NaN. Usage: assert.bool_not_nan(true, case, 'bool is not NaN')
Parameters:
a : bool, value "a" to check is not NaN
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
bool_array_equal(a, b, case, name) Boolean assert arrays are equal. Usage: assert.bool_array_equal(array.from(true), array.from(true), case, ' == ')
Parameters:
a : bool , array "a" to check is identical to array "b"
b : bool , array "b" to check is identical to array "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
str_equal(a, b, case, name) String assert equal. Usage: assert.str_equal('hi', 'hi', case, '"hi" == "hi"')
Parameters:
a : string, value "a" to compare equal to "b"
b : string, value "b" to compare equal to "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
str_not_equal(a, b, case, name) String assert not equal. Usage: assert.str_not_equal('hi', 'bye', case, '"hi" != "bye"')
Parameters:
a : string, value "a" to compare not equal "b"
b : string, value "b" to compare not equal "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
str_nan(a, case, name) String assert is NaN. Usage: assert.str_nan(string(na), case, 'string is NaN')
Parameters:
a : string, value "a" to check is NaN
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
str_not_nan(a, case, name) String assert is not NaN. Usage: assert.str_not_nan('hi', case', 'string is not NaN')
Parameters:
a : string, value "a" to check is not NaN
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
str_in(a, b, case, name) String assert value in string array. Usage: assert.str_in('hi', array.from('hi'), case, '"hi" in ')
Parameters:
a : string, value "a" to check is in array "b"
b : string , array "b" to check contains "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
str_not_in(a, b, case, name) String assert value not in string array. Usage: assert.str_in('hi', array.from('bye'), case, '"hi" in ')
Parameters:
a : string, value "a" to check is not in array "b"
b : string , array "b" to check does not contain "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
str_array_equal(a, b, case, name) String assert arrays are equal. Usage: assert.str_array_equal(array.from('hi'), array.from('hi'), case, ' == ')
Parameters:
a : string , array "a" to check is identical to array "b"
b : string , array "b" to check is identical to array "a"
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the current unit test name, if undefined the test index of the current case is used
Returns: bool, true if the assertion passes, false otherwise
new_case(case, name) Assign a new test case name, for the next set of unit tests. Usage: assert.new_case(case, 'My tests')
Parameters:
case : string , the current test case and array of previous unit tests (__ASSERTS)
name : string, the case name for the next suite of tests
clear(case) Clear all stored unit tests from all cases. Usage: assert.clear(case)
Parameters:
case : string , the current test case and array of previous unit tests (__ASSERTS)
revert(case) Revert the previous unit test. Usage: = assert.revert(case)
Parameters:
case : string , the current test case and array of previous unit tests (__ASSERTS)
Returns: , tuple containing the msg and result of the reverted test
passed(case, revert) Check if the last unit test has passed. Usage: bool success = assert.passed(case)
Parameters:
case : string , the current test case and array of previous unit tests (__ASSERTS)
revert : bool, optionally revert the test
Returns: bool, true only if the test passed
failed(case, revert) Check if the last unit test has failed. Usage: bool failure = assert.failed(case)
Parameters:
case : string , the current test case and array of previous unit tests (__ASSERTS)
revert : bool, optionally revert the test
Returns: bool, true only if the test failed
report(case, verbose) Report the outcome of unit tests that fail. Usage: bool passed = assert.report(case)
Parameters:
case : string , the current test case and array of previous unit tests (__ASSERTS)
verbose : bool, optionally display full report that includes the outcome of all tests
Returns: bool, true only if all tests passed
unittest_assert(case) Assert module unit tests, for inclusion in parent script test suite. Usage: assert.unittest_assert(__ASSERTS)
Parameters:
case : string , the current test case and array of previous unit tests (__ASSERTS)
unittest(verbose) Run the assert module unit tests as a stand alone. Usage: assert.unittest()
Parameters:
verbose : bool, optionally toggle report to display the outcome of all unit tests
The Moon█ OVERVIEW
The Moon is a script that is designed to help Traders analyse their charts using the moon. This script consists of three main features :
1. Moon Phases Pro : This is a more powerful version of the default built-in Moon Phases where it would plot both past cycles and Future cycles with a better accuracy.
2. Moon Lines : This plots the moon's longitude into price. you can also select your desired $/degree ( price vs time unit) to make these lines better suited for your chart and the asset your playing with. We also didn't forget to add an option to enable harmonics of these lines. In addition, you can select "reverse" to get the downtrending plants as well.
3. Moon Angles : This allows you to highlight areas where the moon is at X degree. you can get the Moon at zero aris or 180 degrees or any other degree!.
We also added some styling options to help with the visuals.
█ Future Plans and upgrades to this script may include :
1. Enhanced algorithm for a faster loading/processing script.
2. More future dates plotting.
And more! Feel free to contact me with any feature that you would like to see in this script
█ How to use :
1. Open the settings.
2. Enable your desired tool and adjust the settings.
Give the script a few seconds and you should be set. Don't enable more than 2 tools at the same time, but if you want to do that, you can insert the same script twice or more in your chart.
This script is coded as an addon to the Gann ToolBox package/scripts.